From d03ee57cc56bc311114e277dc82248a18f65ed68 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 8 Oct 2022 23:09:48 -0400 Subject: [PATCH] flowbox: Stop using gtk_style_context_save_to_node --- gtk/gtkflowbox.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index caea4d8796..b9a8c8efb5 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -99,7 +99,6 @@ #include "gtksizerequest.h" #include "gtksnapshot.h" #include "gtkrenderbackgroundprivate.h" -#include "gtkstylecontextprivate.h" #include "gtktypebuiltins.h" #include "gtkviewport.h" #include "gtkwidgetprivate.h" @@ -2509,7 +2508,7 @@ gtk_flow_box_snapshot (GtkWidget *widget, if (priv->rubberband_first && priv->rubberband_last) { - GtkStyleContext *context; + GtkCssStyle *style; GSequenceIter *iter, *iter1, *iter2; GdkRectangle line_rect, rect; GArray *lines; @@ -2521,8 +2520,7 @@ gtk_flow_box_snapshot (GtkWidget *widget, cr = gtk_snapshot_append_cairo (snapshot, &GRAPHENE_RECT_INIT (x, y, width, height)); - context = gtk_widget_get_style_context (widget); - gtk_style_context_save_to_node (context, priv->rubberband_node); + style = gtk_css_node_get_style (priv->rubberband_node); iter1 = CHILD_PRIV (priv->rubberband_first)->iter; iter2 = CHILD_PRIV (priv->rubberband_last)->iter; @@ -2569,8 +2567,8 @@ gtk_flow_box_snapshot (GtkWidget *widget, if (lines->len > 0) { cairo_path_t *path; - GtkBorder border; const GdkRGBA *border_color; + int border_width; GtkSnapshot *bg_snapshot; GskRenderNode *node; @@ -2588,9 +2586,7 @@ gtk_flow_box_snapshot (GtkWidget *widget, cairo_clip (cr); bg_snapshot = gtk_snapshot_new (); - gtk_css_boxes_init_border_box (&boxes, - gtk_style_context_lookup_style (context), - x, y, width, height); + gtk_css_boxes_init_border_box (&boxes, style, x, y, width, height); gtk_css_style_snapshot_background (&boxes, bg_snapshot); node = gtk_snapshot_free_to_node (bg_snapshot); if (node) @@ -2604,16 +2600,15 @@ gtk_flow_box_snapshot (GtkWidget *widget, cairo_append_path (cr, path); cairo_path_destroy (path); - border_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)); - gtk_style_context_get_border (context, &border); + border_color = gtk_css_color_value_get_rgba (style->border->border_top_color ? style->border->border_top_color : style->core->color); + border_width = round (_gtk_css_number_value_get (style->border->border_left_width, 100)); - cairo_set_line_width (cr, border.left); + cairo_set_line_width (cr, border_width); gdk_cairo_set_source_rgba (cr, border_color); cairo_stroke (cr); } g_array_free (lines, TRUE); - gtk_style_context_restore (context); cairo_destroy (cr); } } -- 2.30.2